#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#define MAXLINE    80

int main() {
    int n, a, b;
    char line [MAXLINE];

    while ((n = read(STDIN_FILENO, line, MAXLINE)) > 0) {
        line[n] = 0; // null terminate
        if (sscanf(line, "%d%d", &a, &b) == 2) {
            sprintf(line, "%d\n", a + b);
            n = strlen(line);

            if (write(STDOUT_FILENO, line, n) != n) {
                perror("write error");
                exit(1);
            }
        }
        else {
            if (write(STDOUT_FILENO, "invalid args\n", 13) != 13) {
                perror("write error");
                exit(2);
            }
        }

    }
    return 0;
}
